﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using PSE.ProcessManager.Entity;

///servico devera ser aberto, sem controle de acesso pois pode ser acessado de diversos produtos
namespace PSE.ProcessManager.Common.Gateway
{
    [ServiceContract(
    Name = "InteligenceManagerService",
    Namespace = "http://www.bovespa.com.br/ProcessManager/InteligenceManagerService",
    SessionMode = SessionMode.Required)]
    public interface IInteligenceManagerService
    {
        [OperationContract(Action = "GetInstanceAddress")]
        string GetInstanceAddress(string productId, int processId);

        [OperationContract(Action = "StartProduct")]
        bool StartProduct(string productKey);

        [OperationContract(Action = "StopProduct")]
        bool StopProduct(string productKey);

        [OperationContract(Action = "RestartProduct")]
        bool RestartProduct(string productKey);

        [OperationContract(Action = "AddProduct")]
        bool AddProduct(string productName);

        [OperationContract(Action = "RemoveProduct")]
        bool RemoveProduct(string productName);

        [OperationContract(Action = "ListProducts")]
        List<string> ListProducts();


        [OperationContract(Action = "IsInstanceStarted")]
        bool IsInstanceStarted(string productKey, string instanceKey);

        [OperationContract(Action = "StartInstance")]
        bool StartInstance(string productKey, string instanceKey);

        [OperationContract(Action = "StopInstance")]
        bool StopInstance(string productKey, string instanceKey);

        [OperationContract(Action = "RestartInstance")]
        bool RestartInstance(string productKey, string instanceKey);

        [OperationContract(Name = "AddInstance", Action = "AddInstance")]
        bool AddInstance(string productName,
                         string instanceName,
                         string instanceAddress,
                         string processPath,
                         string stsAuthorityCertificateName,
                         string serviceCertificateName);

        [OperationContract(Name = "AddInstanceWithInteligenceModules", Action = "AddInstanceWithInteligenceModules")]
        bool AddInstance(string productName,
                         string instanceName,
                         string instanceAddress,
                         string processPath,
                         string stsAuthorityCertificateName,
                         string serviceCertificateName,
                         List<InteligenceModuleEntity> inteligenceModules);

        [OperationContract(Action = "RemoveInstance")]
        bool RemoveInstance(string productName, string instanceName);

        [OperationContract(Action = "ListInstances")]
        List<InstanceEntity> ListInstances(string productName);


        [OperationContract(Action = "IsProcessStarted")]
        bool IsProcessStarted(string productKey, string instanceKey, int processId);

        [OperationContract(Action = "StartProcess")]
        bool StartProcess(string productKey, string instanceKey, int processId);

        [OperationContract(Action = "StopProcess")]
        bool StopProcess(string productKey, string instanceKey, int processId);

        [OperationContract(Action = "AddProcess")]
        bool AddProcess(string productName, string instanceName, ProcessEntity process);

        [OperationContract(Action = "RemoveProcess")]
        bool RemoveProcess(string productName, string instanceName, int processId);

        [OperationContract(Action = "ListProcesses")]
        List<ProcessEntity> ListProcesses(string productName, string instanceName);


        [OperationContract(Action = "ListInteligenceModules")]
        List<InteligenceModuleEntity> ListInteligenceModules();
     }
}
